#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_cal_clicked()
{
    try{
       // QMessageBox::information(this,QString("title"),QString(this->ui->guass->isChecked()?"高斯法":"三角法")+"\nsize:"+QString(this->ui->matrixSize->text()));
        shuju t;
        if(this->ui->guass->isChecked()){
            this->ui->outputText->clear();
            this->ui->outputText->appendPlainText(t.solveProblem(this->ui->inputText->toPlainText(),QString(this->ui->matrixSize->text()).toInt(),1));
        }else{
            this->ui->outputText->clear();
            this->ui->outputText->appendPlainText(t.solveProblem(this->ui->inputText->toPlainText(),QString(this->ui->matrixSize->text()).toInt(),0));
        }

    }catch(...){
        QMessageBox::information(this,"title","error");
    }


}

void MainWindow::on_clear_clicked()
{
    this->ui->inputText->clear();
}
